package me.zhengjie.modules.rabbitmq;


import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class AlarmQueue {

    @Bean
    private Exchange alarmExchange() {
        return new DirectExchange(RabbitMqConstants.Exchange, true, false);
    }

    @Bean
    private Queue alarmMQQueue() {
        return new Queue(RabbitMqConstants.Queue);
    }

    @Bean
    private Binding alarmBind(Exchange exchange, Queue alarmMQQueue) {
        return BindingBuilder.bind(alarmMQQueue).to(exchange).with(RabbitMqConstants.Bindkey).noargs();
    }
}